# 求矩阵主对角线元素之和
# 求一个3x3矩阵主对角线元素之和

# 二维数组 循环嵌套

arr = []
for i in range(3):
    arr.append([])
    for j in range(3):
        temp = int(input())
        arr[i].append(temp)

res = 0
for i in range(3):
    res += arr[i][i]
print(res)
